{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="layui-input-inline layui-form">
                            <select name="contract" lay-search="" class="layui-input">
                                <option value="">全部支付类型</option>
                                <option value="1">微信</option>
                                <option value="2">支付宝</option>
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <select name="schoolid" class="layui-input">
                                <option value="" >不限支付状态</option>
                                <option value="1">未支付</option>
                                <option value="2">已支付</option>
                            </select>
                        </div>
                        <div class="layui-input-inline">
                            <input type="text"  name="start" onfocus="wk.lay_date(this);"  class="layui-input layer-date search" placeholder="购买开始时间" />
                        </div>
                        <div class="layui-input-inline">
                            <input type="text"  name="end" onfocus="wk.lay_date(this);"  class="layui-input layer-date search" placeholder="购买结束时间" />
                        </div>
                        <div style="width: 100%;height: 10px;clear: both"></div>
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" style="width: 200px;" id="n_title" class="layui-input search" name="n_title" placeholder="订单号/用户名/手机号"/>
                        </div>
                        <div class="layui-input-inline" style="margin-left: 30px;">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button class="layui-btn layui-btn-normal" id="empty" lay-submit="" lay-filter="LAY-search">
                                重置
                            </button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
                <!--操作框开始-->
                <!--<div class="col-sm-12">-->
                    <!--<div class="input-group" >-->
                        <!--<button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">-->
                            <!--<i class="fa fa-wrench"></i> 导出 <span class="caret"></span>-->
                        <!--</button>-->
                        <!--<ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAll"><i class="fa fa-print"></i> 导出汇总</a></li>-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAllDetail"><i class="fa fa-print"></i> 导出明细</a></li>-->
                        <!--</ul>-->
                    <!--</div>-->
                <!--</div>-->
                <!--操作框结束-->
                <div class="col-sm-12">
                <div class="input-group" >
                    <input type="text" disabled class="layui-input" id="tongji1" value="" style="border:1px solid red;color: red;width: 400px;" />
                </div>
            </div>
            </div>

            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="testReload"></table>

                    <!--状态显示模板-->
                    <script type="text/html" id="pay_type">
                        {{# if(d.order_type == 1){ }}
                        微信
                        {{# } }}
                        {{# if(d.order_type == 2){ }}
                        支付宝
                        {{# } }}
                    </script>
                    <!--状态显示模板-->
                    <script type="text/html" id="is_pay">
                        {{# if(d.order_status == 1){ }}
                        待支付
                        {{# } }}
                        {{# if(d.order_status == 2){ }}
                        已支付
                        {{# } }}
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">

                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
<textarea id="allidsForOut" class="hidden"></textarea>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
            , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Order/index")}'
            , response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
//            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type: 'checkbox', fixed: 'left',}
                , {type: 'numbers', width: 80, title: '序号'}
                , {field: 'order_number', width: '', title: '订单号', align: 'center'}
                , {field: 'order_back_transaction_id', width: '', title: '第三方订单号', align: 'center'}
                , {field: 'user_username', width: '', title: '充值用户', align: 'center'}
                , {field: 'user_phone', width: '', title: '用户电话', align: 'center'}
                , {field: 'order_user_pay', width: '90', title: '充值金额', align: 'center'}
                , {field: 'order_coin', width: '90', title: '获得怼币', align: 'center'}
                , {field: 'order_type', width: '90', title: '支付类型', align: 'center', toolbar: '#pay_type'}
                , {field: 'order_status', width: '90', title: '是否付款', align: 'center', toolbar: '#is_pay'}
//                , {field: 'order_remark', width: '', title: '订单备注', align: 'center'}
                , {field: 'order_time', width: '', title: '创建时间', align: 'center'}
                , {field: 'order_paytime', width: '', title: '支付时间', align: 'center'}
//                , {fixed: 'right', width: 430, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            , done: function (res, curr, count) {
                $('.img-circle').viewer({
                    url: 'data-original',
                });
                $('#tongji1').val('当前条件下总金额：'+res.allmoney+'元          总商品数量：'+res.count);
            }
        });
        //监听状态开关操作
        form.on('switch(OnOff)', function (obj) {
            var num = '';
            obj.elem.checked == true? num = 1: num = 2;
            //用户状态
            wk.status(this.value,num, '{:url("changeGoodStatus")}',obj);
        });
        //批量操作
        var $ = layui.$, active = {
            excelAll: function(){
                //导出Excel
                wk.excelAll('',$('.layui-input').serialize(),"{:url('excelOutOrder')}");
            },
            excelAllDetail: function(){
                //导出Excel
                wk.excelAll('',$('.layui-input').serialize(),"{:url('excelOutDetail')}");
            }
        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                , data = checkStatus.data;
            $.each(data, function (index, item) {
                ids.push(item['n_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>